/** Project : Sticky Notes Plus */
/** Author  : Sainagakishore Srikantham */
/** Email   : ssn.kishore@gmail.com */

/** File    : StickyNote.h */
/** Purpose : This file contains the definition for the class CStickyNote which is basic type of note the user
              can create. This class also is the base for other types of notes. */

#ifndef STICKYNOTE_H
#define STICKYNOTE_H

#include <QWidget>
#include <QIcon>
#include "StickyNotesEnums.h"

QT_BEGIN_NAMESPACE
class QTextEdit;
class QVBoxLayout;
class QHBoxLayout;
class QLabel;
class QTextDocument;
class QCloseEvent;
class QPushButton;
class QSpinBox;
class QLineEdit;
QT_END_NAMESPACE

class CStickyNote : public QWidget
{
    Q_OBJECT
public:
    /** Constructor of the class */
    CStickyNote(int aNoteId, bool aBeingReloaded, NoteType aNoteType);

    /** Destructor of the class */
    ~CStickyNote();

    /** Returns the title of the note */
    QString GetTitle();

    /** Sets the note title */
    void SetTitle(QString aTitle);

    /** Returns the message of the note */
    QString GetMsg();

    /** Sets the note message */
    void SetMsg(QString aMsg);

    /** Returns the type of the note */
    NoteType GetNoteType();

    /** Sets the note type */
    void SetNoteType(NoteType aNoteType);

    /** Returns the note id */
    int GetNoteId();

    /** Sets the note id */
    void SetNoteId(int aNoteId);

    /** Gets the number of hours in which the note expires */
    int GetExpiryInHours();

    /** Gets the number of minutes in which the note expires */
    int GetExpiryInMinutes();

    /** Sets the number of hours in which the note expires */
    void SetExpiryInHours(int aHours);

    /** Sets the number of minutes in which the note expires */
    void SetExpiryInMinutes(int aMinutes);

    /** Returns TRUE if the note has expired */
    bool IsExpired();

    /** Sets the iExpired bool variable */
    void SetExpired(bool aExpired);

protected:
    /** Overriding the base class function to "ignore" the close event */
    void closeEvent(QCloseEvent *event);

private slots:
    /** Function called on the "text modified" signal to check that the user doesn't surpass 140 characters */
    void CheckNoteWidth();

    /** Function called when the 'Delete Note' button is clicked */
    void DeleteClicked();

    /** Function called when the 'Hide Note' button is clicked */
    void HideClicked();

    /** Function called on the "text modified" signal of the title text box */
    void ChangeTitleText();

    /** Function called when the 'Set Tile' button is clicked */
    void SetTitleClicked();

    /** Function called when the 'Hide All But This' button is clicked */
    void HideAllButThisClicked();

private:
    /** Data Components */
    QString iTitle;
    QString iMsg;
    NoteType iNoteType;
    int iNoteId;
    bool iExpired;

    /** Generic Note UI Components */
    QTextEdit* iTextEdit;
    QLabel* iCharsRem;
    QVBoxLayout* iMainLayout;
    QHBoxLayout* iButtonsLayout;
    QHBoxLayout* iTitleWidgetsLayout;
    QHBoxLayout* iHideAllButThisLayout;
    QPushButton* iDeleteButton;
    QPushButton* iHideButton;
    QPushButton* iSetTitleButton;
    QPushButton* iHideAllButThis;
    QLineEdit* iTitleTextBox;

    /** Hour Note UI Components */
    QLabel* iHoursLabel;
    QSpinBox* iHoursSpinBox;
    QLabel* iMinutesLabel;
    QSpinBox* iMinutesSpinBox;
    QHBoxLayout* iSpinBoxLayout;

    static const int iNoteLength;
    static const int iTitleLength;
};

#endif // STICKYNOTE_H
